www.gusucode.com > 印刷装修类企业网站源码 织梦dedecms装修类模板(demo207)源码程序 > 印刷装修类企业网站源码 织梦dedecms装修类模板(demo207)源码程序/www3/js/kf-all.5fbb6568.js

    /*! @Description:youzi100-web @Author:guwei @Update:2015-06-13 */
function jsScrollbar(o,s,a,ev){function findOffsetTop(o){var t=0;if(o.offsetParent)for(;o.offsetParent;)t+=o.offsetTop,o=o.offsetParent;return t}var self=this;this.reset=function(){with(this._parent=o,this._src=s,this.auto=a?a:!1,this.eventHandler=ev?ev:function(){},this._up=this._findComponent("Scrollbar-Up",this._parent),this._down=this._findComponent("Scrollbar-Down",this._parent),this._yTrack=this._findComponent("Scrollbar-Track",this._parent),this._yHandle=this._findComponent("Scrollbar-Handle",this._yTrack),this._trackTop=findOffsetTop(this._yTrack),this._trackHeight=this._yTrack.offsetHeight,this._handleHeight=this._yHandle.offsetHeight,this._x=0,this._y=0,this._scrollDist=5,this._scrollTimer=null,this._selectFunc=null,this._grabPoint=null,this._tempTarget=null,this._tempDistX=0,this._tempDistY=0,this._disabled=!1,this._ratio=(this._src.totalHeight-this._src.viewableHeight)/(this._trackHeight-this._handleHeight),this._yHandle.ondragstart=function(){return!1},this._yHandle.onmousedown=function(){return!1},this._addEvent(this._src.content,"mousewheel",this._scrollbarWheel),this._removeEvent(this._parent,"mousedown",this._scrollbarClick),this._addEvent(this._parent,"mousedown",this._scrollbarClick),this._src.reset(),this._yHandle.style)top="0px",left="2px";this._moveContent(),this._src.totalHeight<this._src.viewableHeight?(this._disabled=!0,this._yHandle.style.visibility="hidden",this.auto&&(this._parent.style.visibility="hidden")):(this._disabled=!1,this._yHandle.style.visibility="visible",this._parent.style.visibility="visible")},this._addEvent=function(o,t,f){o.addEventListener?o.addEventListener(t,f,!1):o.attachEvent?o.attachEvent("on"+t,f):o["on"+t]=f},this._removeEvent=function(o,t,f){o.removeEventListener?o.removeEventListener(t,f,!1):o.detachEvent?o.detachEvent("on"+t,f):o["on"+t]=null},this._findComponent=function(c,o){for(var kids=o.childNodes,i=0;i<kids.length;i++)if(kids[i].className&&kids[i].className==c)return kids[i]},this._scrollbarClick=function(e){return self._disabled?!1:(e=e?e:event,e.target||(e.target=e.srcElement),e.target.className.indexOf("Scrollbar-Up")>-1?self._scrollUp(e):e.target.className.indexOf("Scrollbar-Down")>-1?self._scrollDown(e):e.target.className.indexOf("Scrollbar-Track")>-1?self._scrollTrack(e):e.target.className.indexOf("Scrollbar-Handle")>-1&&self._scrollHandle(e),self._tempTarget=e.target,self._selectFunc=document.onselectstart,document.onselectstart=function(){return!1},self.eventHandler(e.target,"mousedown"),self._addEvent(document,"mouseup",self._stopScroll,!1),!1)},this._scrollbarDrag=function(e){e=e?e:event;var v=(parseInt(self._yHandle.style.top),e.clientY+document.body.scrollTop-self._trackTop);with(self._yHandle.style)top=v>=self._trackHeight-self._handleHeight+self._grabPoint?self._trackHeight-self._handleHeight+"px":v<=self._grabPoint?"0px":v-self._grabPoint+"px",self._y=parseInt(top);self._moveContent()},this._scrollbarWheel=function(e){e=e?e:event;var dir=0;e.wheelDelta>=120&&(dir=-1),e.wheelDelta<=-120&&(dir=1),self.scrollBy(0,20*dir),e.returnValue=!1},this._startScroll=function(x,y){this._tempDistX=x,this._tempDistY=y,this._scrollTimer=window.setInterval(function(){self.scrollBy(self._tempDistX,self._tempDistY)},40)},this._stopScroll=function(){self._removeEvent(document,"mousemove",self._scrollbarDrag,!1),self._removeEvent(document,"mouseup",self._stopScroll,!1),document.onselectstart=self._selectFunc?self._selectFunc:function(){return!0},self._scrollTimer&&window.clearInterval(self._scrollTimer),self.eventHandler(self._tempTarget,"mouseup")},this._scrollUp=function(e){this._startScroll(0,-this._scrollDist)},this._scrollDown=function(e){this._startScroll(0,this._scrollDist)},this._scrollTrack=function(e){var curY=e.clientY+document.body.scrollTop;this._scroll(0,curY-this._trackTop-this._handleHeight/2)},this._scrollHandle=function(e){var curY=e.clientY+document.body.scrollTop;this._grabPoint=curY-findOffsetTop(this._yHandle),this._addEvent(document,"mousemove",this._scrollbarDrag,!1)},this._scroll=function(x,y){y>this._trackHeight-this._handleHeight&&(y=this._trackHeight-this._handleHeight),0>y&&(y=0),this._yHandle.style.top=y+"px",this._y=y,this._moveContent()},this._moveContent=function(){this._src.scrollTo(0,Math.round(this._y*this._ratio))},this.scrollBy=function(x,y){this._scroll(0,(-this._src._y+y)/this._ratio)},this.scrollTo=function(x,y){this._scroll(0,y/this._ratio)},this.swapContent=function(o,w,h){this._removeEvent(this._src.content,"mousewheel",this._scrollbarWheel,!1),this._src.swapContent(o,w,h),this.reset()},this.reset()}function jsScroller(o,w,h){for(var self=this,list=o.getElementsByTagName("ul"),i=0;i<list.length;i++)list[i].className.indexOf("Scroller-Container")>-1&&(o=list[i]);this._setPos=function(x,y){with(x<this.viewableWidth-this.totalWidth&&(x=this.viewableWidth-this.totalWidth),x>0&&(x=0),y<this.viewableHeight-this.totalHeight&&(y=this.viewableHeight-this.totalHeight),y>0&&(y=0),this._x=x,this._y=y,o.style)left=this._x+"px",top=this._y+"px"},this.reset=function(){with(this.content=o,this.totalHeight=o.offsetHeight,this.totalWidth=o.offsetWidth,this._x=0,this._y=0,o.style)left="0px",top="0px"},this.scrollBy=function(x,y){this._setPos(this._x+x,this._y+y)},this.scrollTo=function(x,y){this._setPos(-x,-y)},this.stopScroll=function(){this.scrollTimer&&window.clearInterval(this.scrollTimer)},this.startScroll=function(x,y){this.stopScroll(),this.scrollTimer=window.setInterval(function(){self.scrollBy(x,y)},40)},this.swapContent=function(c,w,h){o=c;for(var list=o.getElementsByTagName("div"),i=0;i<list.length;i++)list[i].className.indexOf("Scroller-Container")>-1&&(o=list[i]);w&&(this.viewableWidth=w),h&&(this.viewableHeight=h),this.reset()},this.content=o,this.viewableWidth=w,this.viewableHeight=h,this.totalWidth=o.offsetWidth,this.totalHeight=o.offsetHeight,this.scrollTimer=null,this.reset()}$(function(){function gd_reset(){scroller=new jsScroller(document.getElementById("Scroller-1"),320,207),scrollbar=new jsScrollbar(document.getElementById("Scrollbar-Container"),scroller,!1)}function xy_fy(strs){var xy_strs='<div class="yz-lt-name"><span class="name-xy">小柚</span><span id="xy-time">'+show()+'</span></div><p class="yz-lt-con">'+strs+"</p>";$("<li>").appendTo($(".Scroller-Container")).html(xy_strs)}function show(){var date=new Date,now="";return now=date.getFullYear()+"/",now=now+(date.getMonth()+1)+"/",now=now+date.getDate()+" ",now=now+date.getHours()+":",now=now+date.getMinutes()+":",now+=date.getSeconds()}var scroller=null,scrollbar=null;gd_reset();var oWin=document.getElementById("yz-kf"),oTi=document.getElementById("yz-kf-title"),bDrag=!1,disX=disY=0;oTi.onmousedown=function(event){return bDrag=!0,disX=event.clientX-oWin.offsetLeft,disY=event.clientY-oWin.offsetTop-oWin.style.marginTop,!1},document.onmousemove=function(event){if(bDrag){var iL=event.clientX-disX,iT=event.clientY-disY,maxL=document.documentElement.clientWidth-oWin.offsetWidth,maxT=document.documentElement.clientHeight-oWin.offsetHeight;return iL=0>iL?0:iL,iL=iL>maxL?maxL:iL,iT=0>iT?0:iT,iT=iT>maxT?maxT:iT,oWin.style.left=iL+"px",oWin.style.top=iT+"px",!1}},document.onmouseup=function(){bDrag=!1};var xy_str_re="您好,柚子装修是一家互联网装修公司。我们致力于使用互联网的方式降低成本和监控装修过程,力争每一单都是价低质优。如果您有什么问题,请留下问题和您的电话,我们会尽快给您满意的答复。";setTimeout(function(){xy_fy(xy_str_re)},500),$("#yh-fs").attr("disabled")&&$("#yh-fs").val("已发送").css("background","#f2f2f2").css("color","#ccc");var settime=null;$("#yh-fs").click(function(e){if(/^(((13[0-9]{1})|(14[0-9]{1})|159|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test($("#yh-phone").val())){var cell=$('input[name="email"]').val(),message=$('textarea[name="message"]').val();$.ajax({type:"POST",url:"/index.php/api/kefu/kefupost",data:"cell="+encodeURIComponent(cell)+"&message="+message,success:function(msg){if("500"==msg)return void alert("请输入正确的手机号,以便小柚能尽快联系到您~");_hmt.push(["_trackPageview","/virtual/succeed_kf_fasong"]);var liuyan_str=$('textarea[name="message"]').val();""==liuyan_str&&(liuyan_str=$("#yh-phone").val());var lt_str='<div class="yk-lt-name"><span id="yk-time">'+show()+'</span><span class="name-yk">游客</span></div><p class="yk-lt-con">'+liuyan_str+"</p>";$("<li>").appendTo($(".Scroller-Container")).html(lt_str),clearInterval(settime),settime=setTimeout(function(){xy_str_re="小柚已经收到您的留言了,我们会尽快与您电话联系,请勿重复发送哟!",xy_fy(xy_str_re),gd_reset();var Scrollertop=$(".Scrollbar-Track").height()-$(".Scrollbar-Handle").height();scrollbar.scrollTo(0,Scrollertop*scrollbar._ratio)},800),$("#yh-fs").attr("disabled",!0).val("已发送").css("background","#f2f2f2").css("color","#ccc"),$("#yh-phone").attr("disabled",!0).css("background","#f2f2f2"),$("#yh-liuyan").attr("disabled",!0).css("background","#f2f2f2")},error:function(err){alert("Sorry!失败。")}}),e.preventDefault()}else $("#yh-phone").addClass("yh-phone-un").val("亲,手机号格式有误~!")}),$("#yh-phone").focus(function(){$("#yh-phone").removeClass("yh-phone-un"),/^\d+$/.test($(this).val())||$(this).val("")}),$("#yh-phone").blur(function(){""==$(this).val()&&$(this).val(this.defaultValue)})});